diff options
| author | secondl1ght <[email protected]> | 2022-08-06 00:04:55 -0600 |
|---|---|---|
| committer | secondl1ght <[email protected]> | 2022-08-06 00:04:55 -0600 |
| commit | f4c85698d32ab1346dcdb75b4244d615a2178e40 (patch) | |
| tree | bee7bd1ec13c5bdc756d5d741ac4660ad539e476 /src/routes/[username]/dashboard.svelte | |
| parent | f0f318279775c3b306284c21b775bd5f1929ab54 (diff) | |
| download | coinos-ui-f4c85698d32ab1346dcdb75b4244d615a2178e40.tar.gz coinos-ui-f4c85698d32ab1346dcdb75b4244d615a2178e40.zip | |
finish withdraw UI, add more validation on support, bug fixes on tx hist
Diffstat (limited to 'src/routes/[username]/dashboard.svelte')
| -rw-r--r-- | src/routes/[username]/dashboard.svelte | 86 |
1 files changed, 53 insertions, 33 deletions
diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte index 7fab2125..d056399f 100644 --- a/src/routes/[username]/dashboard.svelte +++ b/src/routes/[username]/dashboard.svelte @@ -1,7 +1,7 @@ <script> import { post, failure } from '$lib/utils'; import { tick } from 'svelte'; - import { AppHeader } from '$comp'; + import { AppHeader, Icon } from '$comp'; import { rate, user, preferredCurrency } from '$lib/store'; let payreq = '', @@ -19,8 +19,7 @@ await post('/withdraw', { payreq }); withdrawing = false; } catch (e) { - console.log(e); - failure("Withdrawal failed, please contact support."); + failure(e.message); } }; @@ -58,43 +57,64 @@ <div class="px-3 md:px-0 flex justify-center items-center mt-10 lg:mt-0 mb-20"> <div> - <h1 class="text-3xl md:text-4xl font-semibold mb-8">Dashboard</h1> + <h1 class="text-3xl md:text-4xl font-semibold mb-8"> + {withdrawing ? 'Withdraw' : 'Dashboard'} + </h1> + {#if !withdrawing} + <span class="text-secondary mx-auto text-lg font-bold" + >Bitcoin Price: <span class="text-black">{$rate ? btcPrice : 'fetching rate...'}</span> + {$preferredCurrency} + </span> - <span class="text-secondary mx-auto text-lg font-bold" - >Bitcoin Price: <span class="text-black">{$rate ? btcPrice : 'fetching rate...'}</span> - {$preferredCurrency} - </span> + <span class="text-secondary block mt-1" + >Data from <span class="text-black">Binance</span>. + </span> - <span class="text-secondary block mt-1" - >Data from <span class="text-black">Binance</span>. - </span> + <h3 class="text-secondary font-bold border-b pb-1 mt-10 mb-6 w-full md:w-[500px]"> + ACCOUNT BALANCE + </h3> - <h3 class="text-secondary font-bold border-b pb-1 mt-10 mb-6 w-full md:w-[500px]"> - ACCOUNT BALANCE - </h3> + <span class="text-3xl font-bold block mb-1" + >{$rate ? accountBalanceFiat : 'fetching rate...'}</span + > + + <span class="text-secondary text-xl block">{accountBalanceSats} SATS</span> - <span class="text-3xl font-bold block mb-1" - >{$rate ? accountBalanceFiat : 'fetching rate...'}</span - > + <button class="rounded-full border py-2 font-bold w-28 mt-4" on:click={toggle} + >Withdraw</button + > + <p class="text-secondary my-2">You will be charged a 1% withdrawal fee on the amount.</p> + {:else} + <div class="space-y-3 w-[250px] md:w-[500px] md:pr-20"> + <button on:click={() => (withdrawing = false)}> + <Icon icon="arrow-left" style="w-8" /> + </button> - <span class="text-secondary text-xl block">{accountBalanceSats} SATS </span> + <div> + <label for="invoice" class="font-bold mb-1 block">Invoice</label> + <input + bind:this={payreqField} + type="text" + name="payreq" + required + bind:value={payreq} + class="block rounded-2xl p-3 w-full bg-primary" + /> + </div> - <button class="rounded-full border py-2 font-bold w-28 mt-4" on:click={toggle} - >Withdraw</button - > - <p class="text-secondary mt-2">You will be charged a 1% withdrawal fee on the payreq.</p> + <div> + <label for="note" class="font-bold mb-1 block">Note (Optional)</label> + <textarea name="note" rows={2} class="block rounded-2xl p-3 w-full bg-primary" /> + </div> - {#if withdrawing} - <input - bind:this={payreqField} - type="text" - name="payreq" - bind:value={payreq} - class="block border rounded-xl p-3 w-full" - /> - <button class="rounded-full border py-2 font-bold w-28 mt-4" on:click={withdraw} - >Submit</button - > + <button + disabled={!payreq} + class="{!payreq + ? 'opacity-50' + : 'opacity-100'} rounded-2xl border py-3 font-bold w-full mt-2 bg-black text-white" + on:click={withdraw}>Send</button + > + </div> {/if} </div> </div> |
